feat: 完成 #176/#177 MCP 能力建设并补齐质量收口#181
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Member
|
@Cai-Tang-www 功能测试过没有? |
Collaborator
Author
|
bootstrap还没接入mcp注册,还没测试 |
Member
看看这个功能怎么接入其他模块,先测起来。 |
Collaborator
Author
|
收到,已本地测试完成,等我补个测试率 |
Collaborator
|
stdio_client.go (line 771):decodeCallResult 会把非文本 MCP content 吞掉并回退成 ok,这会让 resource_link、image、audio 等结果在主链路里全部丢失。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目标(对应 #176)
在 NeoCode 内建立一套可扩展的 MCP 工具接入基础层,使外部 MCP Server 的能力可以被统一注册、发现、调用,并与现有工具体系保持一致的调用语义。
背景(为什么做)
当前内置工具链路完整,但缺少对 MCP 生态工具的标准接入能力。为后续多 Server、健康管理、动态上下线与策略控制打基础,需要先落地:
范围说明
本 PR 覆盖 #176(基础层)并同步完成 #177(接入主执行链),先让能力可用,再做质量收口。
#176 主要变更(基础能力)
1) MCP Registry
新增 MCP Registry,支持:
2) MCP Adapter / AdapterFactory
新增适配层,将 MCP 工具统一映射为:
mcp.<server>.<tool>3) 模型与数据结构
新增统一抽象:
ToolDescriptorServerSnapshotCallResultServerClient接口(ListTools / CallTool / HealthCheck)#177 主要变更(主链路接入)
1) 接入工具注册与发现链路
internal/tools/registry的ListAvailableSpecs,可与内置工具一起对模型暴露。2) 接入统一执行链路
Execute主路径,统一走 Tool Registry 分发。3) 新增 stdio 传输客户端
新增
StdIOClient(JSON-RPC framed 协议):tools/listtools/callHealthCheck本 PR 额外质量增强(在功能落地后)
resolveErr)。ok污染的问题。stdin == nil防护与Content-Length上限(8MB)。新增/变更接口(对开发者可见)
MCP 侧
internal/tools/mcp/registry.goRegisterServerUnregisterServerRefreshServerToolsHealthCheckCallSnapshotinternal/tools/mcp/adapter.goAdapterFactory.BuildAdaptersAdapter.FullName/Schema/Callinternal/tools/mcp/stdio_client.goNewStdIOClientListToolsCallToolHealthCheckTools 主链路
internal/tools/registry.goSetMCPRegistryListAvailableSpecs(纳入 MCP tools)Execute(支持 MCP 分发)Supports(支持 MCP tool 检测)测试与覆盖
internal/tools/mcp:85.8%internal/tools:95.9%go test ./...go test -race ./internal/tools ./internal/tools/mcpCloses #176
Closes #177